package com.wh.codedemon.design.pattern.singleton;

/**
 * TODO
 *
 * @auther whoo7
 * @date 2024/1/1 21:32
 */
public class LazySingleton {
    private static volatile LazySingleton instance;

    public LazySingleton() {
    }


    public static LazySingleton getInstance() {
        if (instance == null) {
            synchronized (LazySingleton.class) {
                if (instance == null) {
                    instance = new LazySingleton();
                }
            }
        }
        return instance;
    }
}
